﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BTKERP.DAL.DataAccess;

namespace BTKERP.DAL
{
    public class DataContextHelper
    {
        private static Dictionary<string, DBContext> _DBContextCache = new Dictionary<string, DBContext>();


        public static T GetDbContect<T>() where T : DBContext, new()
        {
            string typeName = typeof(T).FullName;
            if (_DBContextCache.ContainsKey(typeName))
            {
                return _DBContextCache[typeName] as T;
            }

            T t = new T();
            _DBContextCache[typeName] = t;
            return t;
        }
    }
}
